//
//  TSFilterItemCollectionViewCell.swift
//  TSProfitProject
//
//  Created by TmmmS on 2019/11/23.
//  Copyright © 2019 TMS. All rights reserved.
//

import UIKit

class TSFilterItemModel {
    var title : String!
    var status : UInt = 0
    var isSelected : Bool = false
}

class TSFilterItemCollectionViewCell: UICollectionViewCell {
    
    private var titleLabel : UILabel!
    private var model : TSFilterItemModel!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        titleLabel = UILabel.init()
        titleLabel.numberOfLines = 0
        titleLabel.textColor = BASE_GRAY_COLOR
        titleLabel.font = UIFont.systemFont(ofSize: 14)
        titleLabel.textAlignment = .center
        titleLabel.adjustsFontSizeToFitWidth = true
        titleLabel.minimumScaleFactor = 0.6
        titleLabel.layer.borderColor = BASE_GRAY_COLOR.cgColor
        titleLabel.layer.borderWidth = 1
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview().inset(5)
            make.top.bottom.equalToSuperview().inset(5)
        }
    }
    
    func setupCell(model:TSFilterItemModel) {
        self.model = model
        titleLabel.text = model.title
        titleLabel.backgroundColor = self.model.isSelected ? BASE_RED_COLOR : WHITE_COLOR
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
